<template name="adminImport">
	<section class="page-container page-home page-static page-settings">
		{{> header sectionName="Import" fullpage="true"}}
		<div class="content">
			{{#unless hasPermission 'run-import'}}
				<p>{{_ "You_are_not_authorized_to_view_this_page"}}</p>
			{{else}}
				{{#if isPreparing}}
					{{> loading}}
				{{else}}

					<div class="rc-button__group">
						<button class="rc-button rc-button--primary action new-import-btn">{{_ "Import_New_File"}}</button>
						{{#if anySuccessfulSlackImports}}
							<input type="button" class="rc-button action download-slack-files-btn" value="{{_ "Download_Pending_Files" }}">
						{{/if}}
					</div>

					{{#if canShowCurrentOperation}}
						<div class="fixed-title">
							<h2>{{_ "Current_Import_Operation"}}</h2>
						</div>

						<div class="section">
							{{> importOperationSummary operation}}

							{{#if canContinueOperation}}
								<button class="rc-button rc-button--primary action prepare-btn">{{_ "Continue"}}</button>
							{{else}}
								{{#if canCheckOperationProgress}}
									<button class="rc-button rc-button--primary action progress-btn">{{_ "Check_Progress"}}</button>
								{{/if}}
							{{/if}}
						</div>
					{{/if}}

					{{#if history}}
						<div class="fixed-title">
							<h2>{{_ "Recent_Import_History"}}</h2>
						</div>

						{{#each history}}
							{{#if isNotCurrentOperation}}
								<div class="section">
									{{> importOperationSummary .}}
								</div>
							{{/if}}
						{{/each}}
					{{/if}}
				{{/if}}
				
			{{/unless}}
		</div>
	</section>
</template>
